*******************Number of Draws********************************

import delimited "ContestLevelDraws4.csv", clear
egen session=group(sessionid)

xtset session



*Treatment Differences*
xtreg final_draws treatment,re
xtreg final_draws treatment,fe



********************Leader vs. Follower (differences as predicted)*********************

import delimited "FourPerson.csv", clear
egen subject=group(subjectid)
egen session=group(sessionid)

xtset subject


gen leader=0
replace leader=1 if mycurrentbest==currentbest

xtlogit decision leader if treatment==1 & currentbest>0,re vce(cluster session)
xtlogit decision leader if treatment==2 & currentbest>0,re vce(cluster session)

clogit decision leader if treatment==1 & currentbest>0,group(subject) vce(cluster session)
clogit decision leader if treatment==2 & currentbest>0,group(subject) vce(cluster session)


********************Drawing as Score Increases (as predicted)********************


import delimited "FourPerson.csv", clear
egen subject=group(subjectid)
egen session=group(sessionid)

xtset subject


gen leader=0
replace leader=1 if mycurrentbest==currentbest


gen period=mod(decisionnumber,10)
replace period=10 if period==0

clogit decision mycurrentbest  if treatment==1 & period==2, group(subject) vce(cluster session)
clogit decision mycurrentbest  if treatment==1 & period==3, group(subject) vce(cluster session)
clogit decision mycurrentbest  if treatment==1 & period==4, group(subject) vce(cluster session)
clogit decision mycurrentbest  if treatment==1 & period==5, group(subject) vce(cluster session)
clogit decision mycurrentbest  if treatment==1 & period==6, group(subject) vce(cluster session)
clogit decision mycurrentbest  if treatment==1 & period==7, group(subject) vce(cluster session)
clogit decision mycurrentbest  if treatment==1 & period==8, group(subject) vce(cluster session)
clogit decision mycurrentbest  if treatment==1 & period==9, group(subject) vce(cluster session)
clogit decision mycurrentbest  if treatment==1 & period==10, group(subject) vce(cluster session)

clogit decision currentbest  if treatment==2 & period==2, group(subject) vce(cluster session)
clogit decision currentbest  if treatment==2 & period==3, group(subject) vce(cluster session)
clogit decision currentbest  if treatment==2 & period==4, group(subject) vce(cluster session)
clogit decision currentbest  if treatment==2 & period==5, group(subject) vce(cluster session)
clogit decision currentbest  if treatment==2 & period==6, group(subject) vce(cluster session)
clogit decision currentbest  if treatment==2 & period==7, group(subject) vce(cluster session)
clogit decision currentbest  if treatment==2 & period==8, group(subject) vce(cluster session)
clogit decision currentbest   if treatment==2 & period==9, group(subject)  vce(cluster session)
clogit decision currentbest  if treatment==2 & period==10, group(subject) vce(cluster session)



